import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SkMembershipOrderVO, SkMembershipOrderForm, SkMembershipOrderQuery } from '@/api/app/SkMembershipOrder/types';

/**
 * 查询开会员订单列表
 * @param query
 * @returns {*}
 */

export const listSkMembershipOrder = (query?: SkMembershipOrderQuery): AxiosPromise<SkMembershipOrderVO[]> => {
  return request({
    url: '/app/SkMembershipOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询开会员订单详细
 * @param id
 */
export const getSkMembershipOrder = (id: string | number): AxiosPromise<SkMembershipOrderVO> => {
  return request({
    url: '/app/SkMembershipOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增开会员订单
 * @param data
 */
export const addSkMembershipOrder = (data: SkMembershipOrderForm) => {
  return request({
    url: '/app/SkMembershipOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改开会员订单
 * @param data
 */
export const updateSkMembershipOrder = (data: SkMembershipOrderForm) => {
  return request({
    url: '/app/SkMembershipOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除开会员订单
 * @param id
 */
export const delSkMembershipOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/SkMembershipOrder/' + id,
    method: 'delete'
  });
};
